Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace XorShiftRng with a custom RNG #466

Merged
merged 1 commit into from Jul 6, 2018
Merged

Replace XorShiftRng with a custom RNG #466

merged 1 commit into from Jul 6, 2018

Conversation

ghost
Copy link

@ghost ghost commented Jul 6, 2018

Using a custom XorShift implementation instead of rand::XorShiftRng improves benchmark results quite a bit:

 name                    before ns/iter  after ns/iter  diff ns/iter   diff %  speedup
 threadpool::spawn_many  5,310,562       4,613,372          -697,190  -13.13%   x 1.15
 threadpool::yield_many  11,949,297      11,979,006           29,709    0.25%   x 1.00

For simplicity, I've also deleted next_thread_id and replaced it with a call to rand::random::<u32>() for generating seeds.

Copy link
Member

@carllerche carllerche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Definitely a good change.

@carllerche carllerche merged commit dc7202c into tokio-rs:master Jul 6, 2018
@ghost ghost deleted the faster-rng branch July 6, 2018 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant